package com.clms.system.controller;

import com.clms.common.R;
import com.clms.system.pojo.vo.OperLogVo;
import com.clms.system.service.OperLogService;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @program: clms-third
 * @description: 日志控制类
 * @author: 大鱼
 * @create: 2021-07-22 18:04
 **/
@RestController
@RequestMapping("/system/log")
public class OperLogController {
    @Autowired
    OperLogService operLogService;

    @PostMapping("operlog/{currentPage}/{pageSize}")
    public R operLogTable(@ApiParam("获取分页数") @PathVariable("currentPage") Integer currentPage, @ApiParam("封装前台搜索条件") @PathVariable("pageSize") Integer pageSize, @RequestBody OperLogVo operLogVo) {

        return operLogService.operLogTable(currentPage, pageSize, operLogVo);
    }

    @DeleteMapping("operlog/removebyid/{operlogId}")
    public R removeperLogById(@PathVariable("operlogId") Integer operlogId) {
        return operLogService.removerById(operlogId);
    }

    @GetMapping("/exportlogs")
    public R exportlogs() {
        return operLogService.exportlogs();
    }

    @GetMapping("/importlogs")
    public R importlogs(MultipartFile file) {
        return operLogService.importlogs();
    }
}
